package com.felix.load;

import java.util.*;

/**
 * Demo
 *
 * @author xjh
 * @version 1.0
 * @date 2019-03-08
 */
public class Demo {

    public static void main(String[] args) {
        Collection<?>[] collections = {new HashSet<String>(), new ArrayList<String>(), new HashMap<String, String>().values()};
        Super subToSuper = new Sub();
        for (Collection collection : collections){
            System.out.println(subToSuper.getType(collection));
        }
        System.out.println(subToSuper.getName());
    }

    abstract static class Super {
        public static String getName(){
            return "Super getName";
        }

        public static String getType(Collection<?> collection) {
            return "Super:collection";
        }

        public static String getType(List<?> list) {
            return "Super:list";
        }

        public String getType(ArrayList<?> list) {
            return "Super:arrayList";
        }

        public static String getType(Set<?> set) {
            return "Super:set";
        }

        public String getType(HashSet<?> set) {
            return "Super:hashSet";
        }
    }

    static class Sub extends Super {
        public static String getName(){
            return "Sub getName";
        }

        public static String getType(Collection<?> collection) {
            return "Sub:collection";
        }
    }

}


